package me.leiusual.sharing.ui.account

import androidx.lifecycle.ViewModel
import dagger.Binds
import dagger.Module
import dagger.android.ContributesAndroidInjector
import dagger.multibindings.IntoMap
import me.leiusual.sharing.di.FragmentScope
import me.leiusual.sharing.di.ViewModelKey

/**
 * Create by leiusual on 2018/8/14
 */
@Module
abstract class AccountModule {

  @FragmentScope
  @ContributesAndroidInjector
  abstract fun accountAgreementFragment(): AccountAgreementFragment

  @Binds
  @IntoMap
  @ViewModelKey(AccountAgreementViewModel::class)
  abstract fun accountAgreementViewModel(accountAgreementViewModel: AccountAgreementViewModel): ViewModel

  @FragmentScope
  @ContributesAndroidInjector
  abstract fun accountForgetFragment(): AccountForgetFragment

  @Binds
  @IntoMap
  @ViewModelKey(AccountForgetViewModel::class)
  abstract fun accountForgetViewModel(accountForgetViewModel: AccountForgetViewModel): ViewModel

  @FragmentScope
  @ContributesAndroidInjector
  abstract fun accountLoginFragment(): AccountLoginFragment

  @Binds
  @IntoMap
  @ViewModelKey(AccountLoginViewModel::class)
  abstract fun accountLoginViewModel(accountLoginViewModel: AccountLoginViewModel): ViewModel

  @FragmentScope
  @ContributesAndroidInjector
  abstract fun accountRegisterFragment(): AccountRegisterFragment

  @Binds
  @IntoMap
  @ViewModelKey(AccountRegisterViewModel::class)
  abstract fun accountRegisterViewModel(accountRegisterViewModel: AccountRegisterViewModel): ViewModel

  @Binds
  abstract fun accountRegisterViewModelDelegate(impl: AccountRegisterViewModelDelegate.Impl): AccountRegisterViewModelDelegate
}